<%@ include file="/html/init.jsp"%>

<%
	String redirect = PortalUtil.getCurrentURL(renderRequest);
%>
<liferay-ui:success key="rule-added" message='<%= LanguageUtil.get(pageContext, "rule-added") %>'/>
<liferay-ui:success key="rule-updated" message='<%= LanguageUtil.get(pageContext, "rule-updated") %>'/>
<liferay-ui:success key="rule-deleted" message='<%= LanguageUtil.get(pageContext, "rule-deleted") %>'/>
<portlet:defineObjects />

<aui:button-row>
	<portlet:actionURL var="addRuleURL" name="addRuleURL">
		<portlet:param name="backURL" value="<%=redirect%>" />
		<portlet:param name="jspPage"
			value="/html/softuirulesengineportlet/ruleAdd.jsp" />
		<portlet:param name="action" value="add" />
	</portlet:actionURL>

	<aui:button
		value='<%=LanguageUtil.get(pageContext, "add-rule")%>'
		onClick="<%=addRuleURL.toString()%>" />
</aui:button-row>

<liferay-ui:search-container delta='5' emptyResultsMessage='<%= LanguageUtil.get(pageContext, "rules-empty-results-message") %>'>
	<liferay-ui:search-container-results
		results="<%= rulesLocalServiceUtil.getruleses(searchContainer.getStart(), searchContainer.getEnd()) %>"
		total="<%= rulesLocalServiceUtil.getrulesesCount() %>"
	/>

	<liferay-ui:search-container-row
		className="com.targeter.rulesengine.model.rules"
		keyProperty="ruleId"
		modelVar="rules" escapedModel="<%= true %>"
	>
		
		<liferay-ui:search-container-column-text
			name='<%=LanguageUtil.get(pageContext, "rule-Name") %>'
			property="ruleName"
		/>
		
		<liferay-ui:search-container-column-text
			name='<%=LanguageUtil.get(pageContext, "rule-modelId") %>'
			property="model"
		/>
		
		<liferay-ui:search-container-column-text
			name='<%=LanguageUtil.get(pageContext, "is-active") %>'
			property="active"
		/>
		
		<liferay-ui:search-container-column-jsp
			align="right"
			path="/html/softuirulesengineportlet/ruleActions.jsp"
		/>
	</liferay-ui:search-container-row>

	<liferay-ui:search-iterator />
</liferay-ui:search-container>